$OpenBSD: patch-libiberty_cp-demangle_c,v 1.2 2016/09/01 17:30:33 pascal Exp $
--- libiberty/cp-demangle.c.orig	Thu May 19 14:05:41 2016
+++ libiberty/cp-demangle.c	Sat Aug  6 19:33:19 2016
@@ -4057,7 +4057,7 @@ static inline void
 d_append_num (struct d_print_info *dpi, int l)
 {
   char buf[25];
-  sprintf (buf,"%d", l);
+  snprintf (buf, 25, "%d", l);
   d_append_string (dpi, buf);
 }
 
@@ -6052,7 +6052,7 @@ __cxa_demangle (const char *mangled_name, char *output
     {
       if (strlen (demangled) < *length)
 	{
-	  strcpy (output_buffer, demangled);
+	  strlcpy (output_buffer, demangled, *length);
 	  free (demangled);
 	  demangled = output_buffer;
 	}
